<?php
	$this->load->view("header");
	
	echo validation_errors();

	if(empty($query)) {
		$novo = TRUE;
		echo form_open('comunidades/inserir');
	} else {
		$novo = FALSE;
		echo form_open('comunidades/atualizar/'.$query['ComunidadeId']);
	}
?>

<p>
Nome<br />
<input type="text" name="Nome" value="<?php echo $novo ? '' : $query['Nome']; ?>" size="50" />
</p>

<p>
Estatuto<br />
<textarea name="Estatuto" rows="10" cols="58" wrap="off"><?php echo $novo ? '' : $query['Estatuto']; ?></textarea>
</p>

<p>
Habilitar Wiki
<select name="WikiHabilitado">
<?php if($novo) { ?>
	<option value="1">Sim</option>
	<option value="0">N&atilde;o</option>
<?php } else { ?>
	<option value="1" <?php echo $query['WikiHabilitado'] == '1' ? 'selected="selected"' : ''; ?>>Sim</option>
	<option value="0" <?php echo $query['WikiHabilitado'] == '0' ? 'selected="selected"' : ''; ?>>N&atilde;o</option>
<?php } ?>
</select>
</p>

<p>
Habilitar Rss
<select name="RssHabilitado">
<?php if($novo) { ?>
	<option value="1">Sim</option>
	<option value="0">N&atilde;o</option>
<?php } else { ?>
	<option value="1" <?php echo $query['RssHabilitado'] == '1' ? 'selected="selected"' : ''; ?>>Sim</option>
	<option value="0" <?php echo $query['RssHabilitado'] == '0' ? 'selected="selected"' : ''; ?>>N&atilde;o</option>
<?php } ?>
</select>
</p>

<p>
Aceitar Por Convite
<select name="AceitarPorConvite">
<?php if($novo) { ?>
	<option value="1">Sim</option>
	<option value="0">N&atilde;o</option>
<?php } else { ?>
	<option value="1" <?php echo $query['AceitarPorConvite'] == '1' ? 'selected="selected"' : ''; ?>>Sim</option>
	<option value="0" <?php echo $query['AceitarPorConvite'] == '0' ? 'selected="selected"' : ''; ?>>N&atilde;o</option>
<?php } ?>
</select>
</p>

<p>
Aceitar Por Ades&atilde;o
<select name="AceitarPorAdesao">
<?php if($novo) { ?>
	<option value="1">Sim</option>
	<option value="0">N&atilde;o</option>
<?php } else { ?>
	<option value="1" <?php echo $query['AceitarPorAdesao'] == '1' ? 'selected="selected"' : ''; ?>>Sim</option>
	<option value="0" <?php echo $query['AceitarPorAdesao'] == '0' ? 'selected="selected"' : ''; ?>>N&atilde;o</option>
<?php } ?>
</select>
</p>

<p>
Limite Forums<br />
<input type="text" name="LimiteForums" value="<?php echo $novo ? '' : $query['LimiteForums']; ?>" size="50" />
</p>

<p>
Tipo Comunidade
<select name="TipoComunidade">
<?php if($novo) { ?>
	<option value="Publica">P&uacute;blica</option>
	<option value="GrupoPesquisa">Grupo de Pesquisa</option>		
<?php } else { ?>
	<option value="Publica" <?php echo $query['TipoComunidade'] == 'Publica' ? 'selected="selected"' : ''; ?>>P&uacute;blica</option>
	<option value="GrupoPesquisa" <?php echo $query['TipoComunidade'] == 'GrupoPesquisa' ? 'selected="selected"' : ''; ?>>Grupo de Pesquisa</option>
<?php } ?>
</select>
</p>

<p>
Limite Enquetes<br />
<input type="text" name="LimiteEnquetes" value="<?php echo $novo ? '' : $query['LimiteEnquetes']; ?>" size="50" />
</p>

<p>
Links Relacionados<br />
<input type="text" name="LinksRelacionados" value="<?php echo $novo ? '' : $query['LinksRelacionados']; ?>" size="50" />
</p>

<p>
<input type="submit" value="Salvar Comunidade" />
</p>

</form>
<?php
  $this->load->view("footer");
?>